package org.grayrabbit.cms.component;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class AssociationDoc extends AbstractComponent{
	@Override
	public Map<String, String> loadparameterMap(String component, String[] ps) {
		Map<String,String> map = new HashMap<String,String>();
		for(int i = 0; i < ps.length; i=i+2) {
			String exp = "";
			if("catIds".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "catIds=" + ArrayToString(ps[i+1].split(","), true);
				map.put("catIds", exp);
			}else if("keywords".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "keywords=" + ArrayToString(ps[i+1].trim().split(","), true);
				map.put("keywords", exp);
			}else if("num".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "num=" + ps[i+1];
				map.put("num", exp);
			}
				
		}
		return map;
	}
	
}
